Media are derived from the abstract base class \texttt{Medium}.

The name (identifier) of a medium can be read by the function
\begin{lstlisting}
const std::string& GetName() const;
\end{lstlisting}
For compound media (\textit{e.\,g.} gas mixtures), 
the identifiers and fractions of the constituents are available via
\begin{lstlisting}
unsigned int GetNumberOfComponents();
void GetComponent(const unsigned int i, std::string& label, double& f);
\end{lstlisting} 

\section{Transport parameters}

\texttt{Medium} classes provide functions for calculating the 
macroscopic transport 
parameters of electrons, holes, and ions as a function of the 
electric and magnetic field:
\begin{lstlisting}
bool ElectronVelocity(const double ex, const double ey, const double ez,
                      const double bx, const double by, const double bz,
                      double& vx, double& vy, double& vz);
bool ElectronDiffusion(const double ex, const double ey, const double ez,
                       const double bx, const double by, const double bz,
                       double& dl, double& dt);
bool ElectronTownsend(const double ex, const double ey, const double ez,
                      const double bx, const double by, const double bz,
                      double& alpha);
bool ElectronAttachment(const double ex, const double ey, const double ez,
                        const double bx, const double by, const double bz,
                        double& eta);
\end{lstlisting}
\begin{description}
  \item[ex, ey, ez] electric field (in V\,/\,cm)
  \item[bx, by, bz] magnetic field (in T)
  \item[vx, vy, vz] drift velocity (in cm\,/\,ns)
  \item[dl, dt] longitudinal and transverse diffusion coefficients 
     (in \(\sqrt{\text{cm}}\))
  \item[alpha] Townsend coefficient (in \(\text{cm}^{-1}\))
  \item[eta] attachment coefficient (in \(\text{cm}^{-1}\))
\end{description}

The above functions return \texttt{true} if the respective parameter 
is available at the requested field.  

Analogous functions are available for holes 
(albeit of course not meaningful for gases), and also for ions 
(except for the Townsend and attachment coefficients). 
A function specific to ions is
\begin{lstlisting}
bool IonDissociation(const double ex, const double ey, const double ez,
                     const double bx, const double by, const double bz,
                     double& diss);
\end{lstlisting}
It returns the dissociation coefficient (in cm\(^{-1}\)). 

The components of the drift velocity are stored in a right-handed 
coordinate system that is aligned with the electric and magnetic field vectors.
More precisely, the axes are along
\begin{itemize}
  \item
  the electric field \(\mathbf{E}\),
  \item
  the component of the magnetic field \(\mathbf{B}\) transverse to 
  \(\mathbf{E}\), 
  \(\mathbf{B}_{t} = \left(\mathbf{E} \times \mathbf{B}\right) \times \textbf{E}\),
  \item
  \(\mathbf{E} \times \mathbf{B}\).
\end{itemize}
The longitudinal diffusion is measured along \(\mathbf{E}\).
The transverse diffusion is the average of the diffusion coefficients 
along the two remaining axes.

\begin{table}
  \centering
  \begin{tabular}{l r}
    \toprule
    transport parameter & scaling \\
    \midrule
    drift velocity & \(v\) vs. \(E/p\) \\
    diffusion coefficients & \(\sigma\sqrt{p}\) vs. \(E/p\) \\
    Townsend coefficient & \(\alpha / p\) vs. \(E/p\) \\
    attachment coefficient & \(\eta / p\) vs. \(E/p\) \\ 
    \bottomrule
  \end{tabular}
  \caption{Pressure scaling relations for gases.}
  \label{Tab:PressureScaling}
\end{table}

\subsection{Transport parameter tables}

The transport parameters can either be stored in a 
one-dimensional table (as a function of the electric field only) or 
in a three-dimensional table (as a function of \textbf{E}, \textbf{B}, 
and the angle \(\theta\) between \textbf{E} and \textbf{B}). 
If only a one-dimensional table is present and the 
drift velocity at \(B \ne 0\) is requested, the Laue-Langevin equation
\cite{BlumRieglerRolandi2008}
\begin{equation*}
  \mathbf{v} = \frac{\mu}{1 + \mu^2 B^2} \left(
  \mathbf{E} + \mu \mathbf{E} \times \mathbf{B} + 
  \mu^2 \mathbf{B} \left(\mathbf{E} \cdot \mathbf{B}\right)\right), \qquad 
  \mu = v / E. 
\end{equation*} 
is used. 

All transport parameters share the same grid 
of electric fields, magnetic fields, and angles.
By default, the field and angular ranges are
\begin{itemize}
  \item
  20 electric field points between 100 V\,/\,cm and 100 kV\,/\,cm, 
  with logarithmic spacing
  \item
  \(\mathbf{B} = 0\), \(\theta = \pi / 2\)
\end{itemize}

For specifying the field grid, two functions are available:
\begin{lstlisting}
void SetFieldGrid(double emin, double emax, int ne, bool logE,
                  double bmin, double bmax, int nb,
                  double amin, double amax, int na);
void SetFieldGrid(const std::vector<double>& efields,
                  const std::vector<double>& bfields,
                  const std::vector<double>& angles);
\end{lstlisting}
\begin{description}
\item[emin, emax] min. and max. value of the electric field range to be covered by the tables
\item[ne] number of electric field grid points
\item[logE] flag specifying whether the \(E\)-field grid points should be 
evenly spaced (\texttt{false}), or logarithmically spaced (\texttt{true}) 
\item[bmin, bmax, ne] magnetic field range and number of values
\item[amin, amax, na] angular range and number of angles
\item[efields, bfields, angles] lists of \(E\), \(B\), and 
\(\theta\) (in ascending order)
\end{description}
Electric fields have to be supplied in V\,/\,cm, magnetic fields in Tesla, 
and angles in rad.

The electron drift velocity components at a specific point in the table 
can be set and retrieved using
\begin{lstlisting}
bool SetElectronVelocityE(const unsigned int ie, const unsigned int ib,
                          const unsigned int ia, const double v);
bool SetElectronVelocityB(const unsigned int ie, const unsigned int ib,
                          const unsigned int ia, const double v);
bool SetElectronVelocityExB(const unsigned int ie, const unsigned int ib,
                            const unsigned int ia, const double v);
bool GetElectronVelocityE(const unsigned int ie, const unsigned int ib,
                          const unsigned int ia, double& v);
bool GetElectronVelocityB(const unsigned int ie, const unsigned int ib,
                          const unsigned int ia, double& v);
bool GetElectronVelocityExB(const unsigned int ie, const unsigned int ib,
                            const unsigned int ia, double& v);
\end{lstlisting}
\begin{description}
  \item[ie] index in the list of electric fields,
  \item[ib] index in the list of magnetic fields,
  \item[ia] index in the list of angles,
  \item[v] velocity
\end{description}
Analogous functions are available for the other transport parameters.
For the Townsend coefficient $\alpha$ and the attachment coefficient
$\eta$, the logarithms $\ln\alpha, \ln\eta$ and not the actual values 
are stored in the tables. 
The same is true for the ion dissociation coefficient. 
 
The gas tables are interpolated using Newton polynomials. 
The order of the interpolation polynomials can be set by means of
\begin{lstlisting}
void SetInterpolationMethodVelocity(const unsigned int intrp);
void SetInterpolationMethodDiffusion(const unsigned int intrp);
void SetInterpolationMethodTownsend(const unsigned int intrp);
void SetInterpolationMethodAttachment(const unsigned int intrp);
void SetInterpolationMethodIonMobility(const unsigned int intrp);
void SetInterpolationMethodIonDissociation(const unsigned int intrp);
\end{lstlisting}
\begin{description}
\item[intrp]
order of the interpolation polynomial 
\end{description}
The interpolation order must be between 1 and the smallest of the two 
numbers: 10 and number of table entries - 1. 
Orders larger than 2 are not recommended.

The method for extrapolating to \(E\) values smaller and larger 
than those present in the table can be set using 
\begin{lstlisting}
void SetExtrapolationMethodVelocity(const std::string extrLow,
                                    const std::string extrHigh);
\end{lstlisting}
\begin{description}
\item[extrLow, extrHigh] extrapolation method to be used 
(``constant'', ``exponential'', or ``linear'')
\end{description}
Similar functions are available for the other transport parameters. 
The extrapolation method set using this function has no effect on 
extrapolation in three-dimensional tables. 
In such tables, polynomial extrapolation is performed with the same 
order as for the interpolation.

The default settings are
\begin{itemize}
  \item
  quadratic interpolation,
  \item
  constant extrapolation towards low values,
  \item
  linear extrapolation towards high values.
\end{itemize}

\subsection{Visualization}
For plotting the transport parameters, the class
\texttt{ViewMedium} can be used. In the following example the 
drift velocities of electrons and holes in silicon are plotted as a 
function of the electric field.
\begin{lstlisting}
MediumSilicon si;
ViewMedium view;
view.SetMedium(&si);
view.PlotElectronVelocity('e');
view.PlotHoleVelocity('e', true);
\end{lstlisting}

The following functions for visualizing transport parameters 
are currently implemented in \texttt{ViewMedium}.
\begin{lstlisting}
void PlotElectronVelocity(const char xaxis, const bool same = false);
void PlotHoleVelocity(const char xaxis, const bool same = false);
void PlotIonVelocity(const char xaxis, const bool same = false);
void PlotElectronDiffusion(const char xaxis, const bool same = false);
void PlotHoleDiffusion(const char xaxis, const bool same = false);
void PlotIonDiffusion(const char xaxis, const bool same = false);
void PlotElectronTownsend(const char xaxis, const bool same = false);
void PlotHoleTownsend(const char xaxis, const bool same = false);
void PlotElectronAttachment(const char xaxis, const bool same = false);
void PlotHoleAttachment(const char xaxis, const bool same = false);
void PlotElectronLorentzAngle(const char xaxis, const bool same = false);
\end{lstlisting}
\begin{description}
  \item[xaxis] quantity to plot on the $x$-axis (\texttt{'e'}: electric field, 
  \texttt{'b'}: magnetic field, \texttt{'a'}: angle),
  \item[same] flag whether to start a new plot (\texttt{false}) or to add the 
plot to the existing ones.
\end{description}
By default, \texttt{ViewMedium} will try to determine the range of the 
$x$ axis based on the grid of electric fields, magnetic fields, 
and angles, and the range of the $y$ axis based on the 
minima and maxima of the function to be plotted. This feature can be 
switched on or off using the functions
\begin{lstlisting}
void EnableAutoRangeX(const bool on = true);
void EnableAutoRangeY(const bool on = true);
\end{lstlisting}
The ranges can be set explicitly using
\begin{lstlisting}
void SetRangeE(const double emin, const double emax, const bool logscale);
void SetRangeB(const double bmin, const double bmax, const bool logscale);
void SetRangeA(const double amin, const double amax, const bool logscale);
void SetRangeY(const double ymin, const double ymax, const bool logscale);
\end{lstlisting} 
\section{Electron scattering rates}

For calculating electron drift lines using ``microscopic tracking'' 
(see Sec.~\ref{Sec:MicroscopicTracking}),
the preparation of a table of electron transport parameters, 
since this method uses directly the electron-atom/molecule 
scattering rates. 

The following functions which are meant to be called from within the 
class \texttt{AvalancheMicroscopic} are available in \texttt{Medium}:
\begin{itemize}
  \item
\begin{lstlisting}
double GetElectronCollisionRate(const double e, const int band = 0);
\end{lstlisting}
returns the total scattering rate of an electron with energy \texttt{e} 
(in~eV) in the \texttt{Medium}. The band index is relevant only 
for semiconducting media.
  \item
\begin{lstlisting}
bool GetElectronCollision(const double e, int& type, int& level,
                          double& e1, double& dx, double& dy, double& dz,
                          std::vector<std::pair<int, double> >& secondaries,
                          int& ndx, int& band);
\end{lstlisting}
\begin{description}
  \item[e]          electron energy prior to the collision
  \item[type]       category of the collision process
                    (see Tab.~\ref{Tab:ElectronCollisionType})
  \item[level]      index of the collision process
  \item[e1]         electron energy after the collision
  \item[dx, dy, dz] incoming and outgoing direction
  \item[secondaries] list of ``ionisation products'' 
                    (\textit{i.\,e.} electrons and ions) 
                    created in the collision. 
                    The first (integer) number in the pair is a flag indicating whether 
                    it is an ion or an electron. The second number corresponds to the kinetic energy. 
  \item[ndxc]       number of ``deexcitation products'' 
                    created in the collision
  \item[band]       band index (irrelevant for gases) 
\end{description}
\end{itemize}

\begin{table}
  \centering
  \begin{tabular}{l r}
    \toprule
    collision type         & index \\
    \midrule
    elastic collision      & 0  \\
    ionisation             & 1  \\
    attachment             & 2  \\
    inelastic collision    & 3  \\
    excitation             & 4  \\
    superelastic collision & 5  \\
    virtual (``null'') collision & 6 \\
    \bottomrule
  \end{tabular}
  \caption{Classification of electron collision processes.}
  \label{Tab:ElectronCollisionType}
\end{table}
\section{Gases}

There are currently two classes implemented that can be used for the 
description of gaseous media: \texttt{MediumGas} and its 
daughter class \texttt{MediumMagboltz}. 
While \texttt{MediumGas} deals only with the interpolation of gas tables 
and the import of gas files, 
\texttt{MediumMagboltz} -- owing to an interface to the 
Magboltz program \cite{Biagi1999} -- can be used for the calculation 
of transport parameters. 
In addition, the latter class provides access to the 
electron-molecule scattering cross-sections used in Magboltz and is 
thus suitable for microscopic tracking (chapter \ref{Chap:Transport}). 

The composition of the gas mixture is specified using
\begin{lstlisting}
bool SetComposition(const std::string& gas1, const double f1 = 1.,
                    const std::string& gas2 = "", const double f2 = 0.,
                    const std::string& gas3 = "", const double f3 = 0.,
                    const std::string& gas4 = "", const double f4 = 0.,
                    const std::string& gas5 = "", const double f5 = 0.,
                    const std::string& gas6 = "", const double f6 = 0.);
\end{lstlisting}
\begin{description}
  \item[gas1, \dots, gas6] identifier of the molecule/atom
  \item[f1, \dots, f6] fraction of the respective molecule/atom   
\end{description}
A valid gas mixture comprises at least one and at most six 
different species. 
A list of the presently available gases and their identifiers 
can be found in the appendix. 
The fractions have to be strictly positive and 
may add up to any non-zero value; 
internally they will be normalized to one.

The gas density is specified in terms of pressure (Torr) 
and temperature (K):
\begin{lstlisting}
void SetPressure(const double p);
void SetTemperature(const double t);
\end{lstlisting}
Note that the density is calculated using the ideal gas law. 

In the following example the gas mixture is set 
to Ar/CH\(_{4}\) (80/20) at 
atmospheric pressure and 20\(^{\circ}\)\,C.
\begin{lstlisting}
MediumMagboltz* gas = new MediumMagboltz();
// Set the composition
gas->SetComposition("ar", 80., "ch4", 20.);
gas->SetTemperature(293.15);
gas->SetPressure(760.);
\end{lstlisting}

The function
\begin{lstlisting}
void PrintGas();
\end{lstlisting}
prints information about the present transport parameter tables and 
cross-section terms (if available). 

\subsection{Ion transport}

The \texttt{\$GARFIELD\_HOME/Data} directory includes a few files 
(\textit{e.~g.} \texttt{IonMobility\_Ar+\_Ar.txt} for Ar\(^{+}\) ions in argon) 
containing ion mobility data (more precisely: a table of 
reduced electric fields \(E/N\) and corresponding mobilities).
The reduced electric fields are given in units of   
Td\footnote{1\,Td = 10\(^{-17}\) V\,cm\(^{2}\)}) and the mobility values 
in cm\(^{2}\)\,V\(^{-1}\)\,s\(^{-1}\). 
These mobility files can be imported using
\begin{lstlisting}
bool MediumGas::LoadIonMobility(const std::string& filename);
\end{lstlisting}
\begin{description}
  \item[filename] path and filename of the mobility file
\end{description}
Extensive compilations of ion mobilities and diffusion coefficients 
can be found in Refs.~\cite{Ellis1976,Ellis1978,Ellis1984,Viehland1995}. 

\subsection{Magboltz}

Magboltz, written by Steve Biagi, is a program 
for the calculation of electron transport properties in gas 
mixtures using semi-classical Monte Carlo simulation
\cite{Biagi1999}. 
It includes a database of electron-atom/molecule cross-sections 
for a large number of detection gases. 

In order to run Magboltz via the \texttt{MediumMagboltz} interface class
given electric field, magnetic field and field angle, the following 
function is provided:
\begin{lstlisting}
void RunMagboltz(const double e, const double b, const double btheta,
                 const int ncoll, bool verbose, 
                 double& vx, double& vy, double& vz,
                 double& dl, double& dt, double& alpha, double& eta,
                 double& lor, double& vxerr, double& vyerr, double& vzerr,
                 double& dlerr, double& dterr,
                 double& alphaerr, double& etaerr, double& lorerr 
                 double& alphatof, std::array<double, 6>& difftens);
\end{lstlisting}
\begin{description}
  \item[e, b, btheta] 
    \(\mathbf{E}\) field, \(\mathbf{B}\) field, and  angle
  \item[ncoll] 
    number of collisions (in multiples of \(10^{7}\)) over which 
    the electron is tracked
  \item[verbose] 
    flag switching on/off full output from Magboltz
  \item[vx, vy, vz] 
    drift velocity along \(\mathbf{E}\) (\(vz\)), 
    along \(\mathbf{B}_{t}\) (\(vy\)), and  
    along \(\mathbf{E} \times \mathbf{B}\) (\(vy\))
  \item[dl, dt]
    diffusion coefficients
  \item[alpha, eta]
    Townsend and attachment coefficient calculated using the
    SST technique or, at low fields, the ionization/loss rate
  \item[lor]
    Lorentz angle, calculated from the components of the drift velocity
  \item[vxerr, vyerr, \dots, etaerr] 
    statistical error of the calculation in \(\%\)
  \item[alphatof]
    alternative estimate of the effective Townsend coefficient 
    \(\alpha - \eta\) based on the Time-Of-Flight method 
  \item[difftens]
    components of the diffusion tensor ($\sigma_{zz}$, $\sigma_{xx}$, 
    $\sigma_{yy}$, $\sigma_{xz} = \sigma_{zx}$, $\sigma_{yz} = \sigma_{zy}$,
    $\sigma_{xy} = \sigma_{yx}$) 
\end{description}
By default, the max. energy of the cross-section table  
is chosen automatically by Magboltz. Using
\begin{lstlisting}
void EnableAutoEnergyLimit(const bool on = true);
\end{lstlisting} 
one can disable this feature. The program then uses the upper energy 
limit set using \texttt{SetMaxElectronEnergy}. 

For inelastic gases, setting \(\texttt{nColl} = 2 \dots 5\)
should give an accuracy of about \(1\%\). 
An accuracy better than \(0.5\%\) can be achieved by 
\(\texttt{nColl} > 10\). 
For pure elastic gases such as Ar, \texttt{nColl} should 
be at least 10.  

Recent versions of Magboltz allow the thermal motion of the gas 
atoms/molecules to be taken into account in the simulation. 
This feature can be enabled or disabled using
\begin{lstlisting}
void EnableThermalMotion(const bool on);
\end{lstlisting} 
By default the option is switched off, \texttt{i. e.} the gas 
is assumed to be 0\,K. 

In order to calculate the electron transport parameters 
for all values of \(\mathbf{E}\), \(\mathbf{B}\), 
and \(\theta\) included in the current field grid, 
the function
\begin{lstlisting}
void GenerateGasTable(const int numCollisions, const bool verbose);
\end{lstlisting}
can be used. In addition to the transport parameters, this function also 
retrieves the rates calculated by Magboltz for each excitation and 
ionisation level, and stores them in the gas table. These can be used 
later to adjust the Townsend coefficient based on the Penning transfer 
probabilities set by the user.
 
Electron transport parameter tables can be saved to file 
and read from file by means of
\begin{lstlisting}
bool WriteGasFile(const std::string& filename);
bool LoadGasFile(const std::string& filename);
\end{lstlisting}

The format of the gas file used in Garfield++ is compatible with the 
one used in Garfield 9. 

Gas files for the same gas composition and the same temperature and pressure
can be merged using
\begin{lstlisting}
bool MergeGasFile(const std::string& filename, const bool replaceOld);
\end{lstlisting}
\begin{description}
  \item[filename] name of the gas file to be loaded and merged with the 
present gas table,
  \item[replaceOld] flag indicating whether new (\texttt{replaceOld = true}) or existing values should be used in case of overlaps between the 
two tables. 
\end{description}
Suppose we have two gas files for Ar/CO$_{2}$, one for a $B$ field of 1\,T
and one for $B = 2$\,T. We can combine the two tables 
with the following piece of code.
\begin{lstlisting}
MediumMagboltz gas;
gas.LoadGasFile("ar_co2_1T.gas");
gas.MergeGasFile("ar_co2_2T.gas");
// Save the merged table.
gas.WriteGasFile("ar_co2_merged.gas");
\end{lstlisting} 

\subsubsection{Scattering rates}

As a prerequisite for ``microscopic tracking'' a 
table of the electron scattering rates 
(based on the electron-atom/molecule cross-sections included in the 
Magboltz database) for the 
current gas mixture and density needs to be prepared. 
This can be done using the function 
\begin{lstlisting}
bool Initialise(const bool verbose);
\end{lstlisting}
If the flag \texttt{verbose} is set to \texttt{true}, 
some information (such as gas properties, and collision rates at selected 
energies) is printed during the initialisation.  

If 
\begin{lstlisting}
void EnableCrossSectionOutput();
\end{lstlisting}
is called prior to \texttt{Initialise}, a table of the cross-sections 
(as retrieved from Magboltz) is written to a file \texttt{cs.txt} 
in the current working directory. 

By default, the table of scattering rates extends from 0 to 40\,eV. 
The max. energy to be included in the table can be set using
\begin{lstlisting}
SetMaxElectronEnergy(const double e);
\end{lstlisting}
\begin{description}
\item[e]
  max. electron energy (in eV).
\end{description}
Up to an upper limit of 400\,eV, equidistant energy steps are used.
If the max. energy exceeds this value, logarithmically spaced 
energy steps are used for the high-energy part ($>400$\,eV) 
of the cross-section table.

The parameters of the cross-section terms in the present gas mixture 
can be retrieved via
\begin{lstlisting}
int GetNumberOfLevels();
bool GetLevel(const unsigned int i, int& ngas, int& type, std::string& descr, double& e);
\end{lstlisting}
\begin{description}
  \item[i] index of the cross-section term
  \item[ngas] index of the gas in the mixture
  \item[type] classification of the cross-section term 
              (see Table~\ref{Tab:ElectronCollisionType})
  \item[descr] description of the cross-section term (from Magboltz)
  \item[e] energy loss
\end{description}

It is sometimes useful to know the frequency with which individual levels 
are excited in an avalanche (or along a drift line). 
For this purpose, \texttt{MediumMagboltz} keeps track of the number of times 
the individual levels are sampled in \texttt{GetElectronCollision}. 
These counters are accessible through the functions
\begin{lstlisting}
unsigned int GetNumberOfElectronCollisions();
unsigned int GetNumberOfElectronCollisions(int& nElastic, int& nIonising, 
                                           int& nAttachment, int& nInelastic, 
                                           int& nExcitation, int& nSuperelastic);
unsigned int GetNumberOfElectronCollisions(const unsigned int level);
\end{lstlisting}
The first function returns total number of electron collisions (\textit{i.\,e.} calls 
to \texttt{GetElectronCollisions}) since the last reset. 
The second function additionally provides the number of collisions of each 
cross-section category (elastic, ionising etc.). 
The third function returns the number of collisions for a specific cross-section term.
The counters can be reset using
\begin{lstlisting}
void ResetCollisionCounters();
\end{lstlisting} 

\subsubsection{Excitation transfer}\label{Sec:PenningTransfer}

Penning transfer can be taken into account in terms of a transfer efficiency 
\(r_{i}\), \textit{i.\,e.} the probability for an excited level \(i\) with an  
excitation energy \(\epsilon_{i}\) exceeding the ionisation potential 
\(\epsilon_{\text{ion}}\) of the mixture to 
be ``converted'' to an ionisation.
The simulation of Penning transfer can be switched on/off using
\begin{lstlisting}
void EnablePenningTransfer(const double r, const double lambda);
void EnablePenningTransfer(const double r, const double lambda, 
                           std::string gasname);
void DisablePenningTransfer();
void DisablePenningTransfer(std::string gasname);
\end{lstlisting}
\begin{description}
  \item[r] value of the transfer efficiency
  \item[lambda] distance characterizing the spatial extent of Penning transfers; 
                except for special studies, this number should be set to zero
  \item[gasname] name of the gas the excitation levels of which are to be assigned 
                 the specified transfer efficiency 
\end{description}
The functions without the \texttt{gasname} parameter
switch on/off Penning transfer globally for all gases in the mixture. 
Note that \(r\) is an average transfer efficiency, it is assumed to be the same 
for all energetically eligible levels (\(\epsilon_{i} > \epsilon_{\text{ion}}\)).

If the gas table includes excitation and ionisation rates as function 
of the electric and magnetic fields, the Townsend coefficient is updated 
accordingly when calling \texttt{EnablePenningTransfer} 
(or \texttt{DisablePenningTransfer}). More precisely,  
the adjusted Townsend coefficient is given by
\begin{equation*}
  \alpha = \alpha_{0} \frac{\sum_{i} r_{\text{exc}, i} + \sum_{i} r_{\text{ion}, i}}{\sum_{i} r_{\text{ion}, i}},
\end{equation*}
where $\alpha_{0}$ is the Townsend coefficient calculated without Penning 
transfers,
$r_{\text{exc}, i}$ is the rate of an excited level $i$ with an excitation 
energy above the ionisation potential of the gas mixture, and 
$r_{\text{ion}, i}$ is the rate of an ionization level $i$.

\section{Semiconductors}
\subsection{Silicon}\label{Sec:Silicon}
Like for all \texttt{Medium} classes the user has the possibility to specify the 
transport parameters in tabulated form 
as function of electric field, magnetic field, and angle. 
If no such tables have been entered, the transport parameters are calculated 
based on empirical parameterizations (as used, for instance, in device simulation 
programs). Several mobility models are implemented in \texttt{MediumSilicon}.
\begin{table}
  \begin{tabular}{l . . . .}
    \toprule
      & \multicolumn{2}{c}{electrons} & 
        \multicolumn{2}{c}{holes} \\
      & \multicolumn{1}{c}{\(\mu_{L}\) [\(10^{-6}\) cm\(^{2}\)\,V\(^{-1}\)\,ns\(^{-1}\)]}
      & \multicolumn{1}{c}{\(\beta\)}
      & \multicolumn{1}{c}{\(\mu_{L}\) [\(10^{-6}\) cm\(^{2}\)\,V\(^{-1}\)\,ns\(^{-1}\)]}
      & \multicolumn{1}{c}{\(\beta\)} \\
    \midrule
    Sentaurus \cite{Lombardi1988} & 1.417 & -2.5 & 0.4705 & -2.5 \\
    Minimos \cite{Haensch1990}  & 1.43  & -2.0 & 0.46   & -2.18 \\
    Reggiani \cite{OmarReggiani1987} & 1.32  & -2.0 & 0.46   & -2.2 \\
    \bottomrule
  \end{tabular}
  \caption{Lattice mobility parameter values.}
  \label{Tab:LatticeMobility}
\end{table} 
For the mobility \(\mu_{0}\) at low electric fields, 
the following options are available: 
\begin{itemize}
  \item
  Using 
  \begin{lstlisting}
void SetLowFieldMobility(const double mue, const double mh);
  \end{lstlisting}
  \begin{description}
    \item[mue] electron mobility (in cm\(^{2}\)/(V ns))
    \item[muh] hole mobility (in cm\(^{2}\)/(V ns))
  \end{description}
  the values of low-field electron and hole mobilities
  can be specified explicitly by the user.
  \item
  The following functions select the model to be used for the 
  mobility due to phonon scattering:
  \begin{lstlisting}
void SetLatticeMobilityModelMinimos();
void SetLatticeMobilityModelSentaurus();
void SetLatticeMobilityModelReggiani();
  \end{lstlisting} 
  In all cases, the dependence of the lattice mobility \(\mu_{L}\) 
  on the temperature \(T\) is described by 
  \begin{equation}\label{Eqn:LatticeMobilityTemperatureDependence}
    \mu_{L}\left(T\right) = \mu_{L}\left(T_{0}\right) 
              \left(\frac{T}{T_{0}}\right)^{\beta}, \qquad T_{0} = 300\text{ K}.
  \end{equation}
  The values of the parameters \(\mu_{L}\left(T_{0}\right)\) and \(\beta\) 
  used in the different models are shown in Table~\ref{Tab:LatticeMobility}. 
  By default, the ``Sentaurus'' model is activated. 
  \item
  The parameterization to be used for modelling the impact of 
  doping on the mobility is specified using
  \begin{lstlisting}
void SetDopingMobilityModelMinimos();
void SetDopingMobilityModelMasetti();
  \end{lstlisting}
  The first function activates the model used in Minimos 6.1 
  (see Ref.~\cite{Haensch1990}). Using the second function the 
  model described in Ref.~\cite{Masetti1983} is activated (default setting).  
\end{itemize}
For modelling the velocity as function of the electric field, 
the following options are available:
\begin{itemize}
  \item
  The method for calculating the high-field saturation velocities 
  can be set using
\begin{lstlisting}
void SetSaturationVelocity(const double vsate, const double vsath);
void SetSaturationVelocityModelMinimos();
void SetSaturationVelocityModelCanali();
void SetSaturationVelocityModelReggiani();
\end{lstlisting}
  The first function sets user-defined saturation velocities (in cm/ns) for 
  electrons and holes. The other functions activate different parameterizations 
  for the saturation velocity as function of temperature. In the Canali model 
  \cite{Canali1975}, which is activated by default,
  \begin{eqnarray*}
    v_{\text{sat}}^{e} & = & 0.0107 \left(\frac{T_{0}}{T}\right)^{0.87} \text{ cm/ns}, \\ 
    v_{\text{sat}}^{h}  & = & 0.00837 \left(\frac{T_{0}}{T}\right)^{0.52} \text{cm/ns}, \\
  \end{eqnarray*}
  where \(T_{0}\) = 300~K. The expressions for the other two implemented 
  models can be found in Refs.~\cite{OmarReggiani1987,Quay2000}. 
  \item
  The parameterization of the mobility as function of the electric field 
  to be used can be selected using
\begin{lstlisting}
void SetHighFieldMobilityModelMinimos();
void SetHighFieldMobilityModelCanali();
void SetHighFieldMobilityModelReggiani();
void SetHighFieldMobilityModelConstant();
\end{lstlisting}
  The last function requests a constant mobility (\textit{i.\,e.} linear dependence of the 
  velocity on the electric field). 
  The models activated by the other functions used the following expressions
  \begin{eqnarray*}
    \mu^{e}\left(E\right) = \frac{2\mu_{0}^{e}}
                             {1 + \sqrt{1 + \left(\frac{2\mu_{0}^{e}E}{v_{\text{sat}}^{e}}\right)^{2}}}, \qquad 
    \mu^{h}\left(E\right) = \frac{\mu_{0}^{h}}{1 + \frac{\mu_{0}}{v_{\text{sat}}^{h}}}, \qquad
    \text{(Minimos)} \\
    \mu^{e,h}\left(E\right) = \frac{\mu_{0}^{e,h}}
                             {\left(1 + \left(\frac{\mu_{0}^{e,h}E}{v_{\text{sat}^{e,h}}}\right)^{\beta^{e,h}}\right)^{\frac{1}{\beta^{e,h}}}}, \qquad 
    \text{(Canali \cite{Canali1975})} \\ 
    \mu^{e}\left(E\right) = \frac{\mu_{0}^{e}}
                             {\left(1 + \left(\frac{\mu_{0}^{e}E}{v_{\text{sat}}^{e}}\right)^{3/2}\right)^{2/3}}, \qquad
    \mu^{h}\left(E\right) = \frac{\mu_{0}^{h}}
                             {\left(1 + \left(\frac{\mu_{0}^{h}E}{v_{\text{sat}}^{h}}\right)^{2}\right)^{1/2}}, \qquad
    \text{(Reggiani \cite{OmarReggiani1987})}
  \end{eqnarray*}
  By default, the Canali model is used.
\end{itemize}

For the impact ionization coefficient, the user has currently the choice 
between the models of Grant \cite{Grant1973},
van Overstraeten and de Man \cite{VanOverstraeten1970}, and Massey 
\cite{Massey2006}.
\begin{lstlisting}
void SetImpactIonisationModelGrant();
void SetImpactIonisationModelVanOverstraetenDeMan();
void SetImpactIonisationModelMassey();
\end{lstlisting}
By default, the model by van Overstraeten and de Man is used.

On an experimental basis, electron collision rates for use with microscopic tracking 
are also included.
 
\subsection{Gallium arsenide}
By default, \texttt{MediumGaAs} uses 
Eq.~\eqref{Eqn:LatticeMobilityTemperatureDependence} for calculating the 
low-field lattice mobility, with 
\begin{equation*}
\mu_{L}\left(T = 300\,\text{K}\right) = 8\times10^{-6}\,\text{cm}^{2}\,\text{V}^{-1}\,\text{ns}^{-1}, \qquad \beta=-1
\end{equation*}
for electrons and 
\begin{equation*}
\mu_{L}\left(T = 300\,\text{K}\right) = 0.4\times10^{-6}\,\text{cm}^{2}\,\text{V}^{-1}\,\text{ns}^{-1}, \beta=-2.1
\end{equation*}
for holes. Alternatively, the low-field mobilities can be set explicitly using
\begin{lstlisting}
SetLowFieldMobility(const double mue, const double muh);
\end{lstlisting}
For the dependence of the mobility on the electric field $E$, the 
parameterizations \cite{Barnes1976} 
\begin{equation*}
  \mu^{e}\left(E\right) = \frac{\mu_{0}^{e} + \frac{v_{\text{sat}}}{E}\left(\frac{E}{E_{c}}\right)^{4}}{1 + \left(\frac{E}{E_{c}}\right)^4}, \qquad
  \mu^{h}\left(E\right) = \frac{\mu_{0}^{h} + \frac{v_{\text{sat}}}{E_{c}}}{1 + \frac{E}{E_{c}}}, \qquad E_{c} = 4000\,\text{V}\,/\,\text{cm}
\end{equation*}
are used, and the saturation velocity is calculated using
\begin{equation*}
  v_{\text{sat}}^{e,h} = 1.13\times10^{-2} - 3.6\times10^{-3}\left(\frac{T}{T_{0}}\right)\,\text{cm}\,/\,\text{ns}. 
\end{equation*}

The Townsend (impact ionization) coefficient as a function of the 
electric field $E$ is calculated using
\begin{equation*}
  \alpha^{e} = a \exp\left(-\left(\frac{b}{E}\right)^{1.75}\right), \qquad
  \alpha^{h} = a \exp\left(-\left(\frac{b}{E}\right)^{1.82}\right).
\end{equation*} 
